import { defineStore } from 'pinia';

export interface IGlobalStoreProps {
    counter: number;
}

export const useGlobalStore = defineStore({
    id: 'globalStore',
    state: (): IGlobalStoreProps => ({
        counter: 0
    }),
    getters: {
        doubleCounter: (state: IGlobalStoreProps) => state.counter * 2
    },
    actions: {
        setCounter(newCounter: number) {
            this.counter = newCounter;
        }
    }
})